import React, { useEffect } from 'react';
import AssionUi from '../ui/AssionUi'
import { useDispatch,useSelector} from 'react-redux'
import { loadAsync } from '../actionCreater'

// @connect(
//     state=>{
//         return {
//             data:state.assign.data
//         }
//     },
//     dispatch=>({
        
//         loadData(){
//             console.log(dispatch)
//             dispatch(loadAsync())
//         }
//     })

// )
const AssignWork = (props)=> {

    let data = useSelector( state => state.assign.data )
    
        
        const dispatch =  useDispatch()
        useEffect(()=>{
            dispatch( loadAsync() )
        },[dispatch])

    // componentDidMount(){
    //     this.props.loadData()
    // }

    return (
        <AssionUi data={data}></AssionUi>
    );
}

export default AssignWork;